/*
 * Swiper Smooth Progress 1.1.0
 * Smooth progress plugin for Swiper
 *
 * http://www.idangero.us/sliders/swiper/plugins/progress.php
 *
 * Copyright 2010-2014, Vladimir Kharlampidi
 * The iDangero.us
 * http://www.idangero.us/
 *
 * Licensed under GPL & MIT
 *
 * Released on: January 29, 2014
 */
Swiper.prototype.plugins.progress = function(a) {
	function b() {
		for (var b = 0; b < a.slides.length; b++) {
			var c = a.slides[b];
			c.progressSlideSize = e ? a.h.getWidth(c) : a.h.getHeight(c), c.progressSlideOffset = "offsetLeft" in c ? e ? c.offsetLeft : c.offsetTop : e ? c.getOffset().left - a.h.getOffset(a.container).left : c.getOffset().top - a.h.getOffset(a.container).top
		}
		d = e ? a.h.getWidth(a.wrapper) + a.wrapperLeft + a.wrapperRight - a.width : a.h.getHeight(a.wrapper) + a.wrapperTop + a.wrapperBottom - a.height
	}
	function c(b) {
		var c, b = b || {
			x: 0,
			y: 0,
			z: 0
		};
		c = 1 == a.params.centeredSlides ? e ? -b.x + a.width / 2 : -b.y + a.height / 2 : e ? -b.x : -b.y;
		for (var f = 0; f < a.slides.length; f++) {
			var g = a.slides[f],
				h = 1 == a.params.centeredSlides ? g.progressSlideSize / 2 : 0,
				i = (c - g.progressSlideOffset - h) / g.progressSlideSize;
			g.progress = i
		}
		a.progress = e ? -b.x / d : -b.y / d, a.params.onProgressChange && a.fireCallback(a.params.onProgressChange, a)
	}
	var d, e = "horizontal" == a.params.mode,
		f = {
			onFirstInit: function() {
				b(), c({
					x: a.getWrapperTranslate("x"),
					y: a.getWrapperTranslate("y")
				})
			},
			onInit: function() {
				b()
			},
			onSetWrapperTransform: function(a) {
				c(a)
			}
		};
	return f
};